In [1]:
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
from astropy.coordinates import SkyCoord
from astropy import units as u
from astropy import table
import pandas as pd
#https://github.com/jobovy/gaia_tools
import gaia_tools.load as gload
from gaia_tools import xmatch
import read_data as rd
Load catalogs with Jo Bovy's code
In [2]:
tgas_cat= gload.tgas()
In [3]:
tgas_tab = table.Table(tgas_cat)
df = tgas_tab.to_pandas()
In [4]:
df.columns
Out[4]:
In [5]:
df[['parallax_pmdec_corr','parallax_pmra_corr','parallax','parallax_error']].describe()
Out[5]:
In [6]:
plt.figure()
plt.plot(df['parallax'],df['parallax_error'],'k.')
Out[6]:
In [7]:
df['distance'] = 1./df['parallax'] #in kpc
In [8]:
plt.figure()
plt.hist(df['phot_g_mean_mag'],bins=np.arange(4,20,.25))
plt.xlabel('Gaia G (330-1050nm)')
Out[8]:
In [9]:
def contourbin(x,y,binx,biny,ax=None,**kwargs):
h,xe,ye = np.histogram2d(np.array(x),np.array(y),bins=[binx,biny])
xmid = (xe[1:]+xe[:-1])/2.0
ymid = (ye[1:]+ye[:-1])/2.0
X, Y = np.meshgrid(xmid,ymid)
ax.contour(X,Y,h.T,**kwargs)
In [10]:
fig,ax = plt.subplots()
ii = np.logical_and(df['distance'] < 100, df['distance'] >= 0)
plt.plot(df[ii]['distance'],df[ii]['b'],'k.')
binx = np.arange(0,100,10)
biny = np.arange(-90,90,10)
contourbin(df[ii]['distance'],df[ii]['b'],binx,biny,ax,colors='red')
In [11]:
galah_cat = gload.galah()
rave_cat = gload.rave()
In [12]:
rave_cat.colnames
Out[12]:
In [13]:
m1,m2,sep = xmatch.xmatch(tgas_cat,rave_cat,colRA1='ra',colDec1='dec',colRA2='RAdeg',colDec2='DEdeg')
tgas_rave = tgas_cat[m1]
rave_tgas = rave_cat[m2]
plt.figure()
plt.hist(sep)
print len(rave_cat), len(rave_tgas)
print len(tgas_cat), len(tgas_rave)/float(len(tgas_cat))
In [14]:
m1,m2,sep = xmatch.xmatch(tgas_cat,galah_cat,colRA1='ra',colDec1='dec',colRA2='RA',colDec2='dec')
tgas_galah= tgas_cat[m1]
galah_tgas= galah_cat[m2]
plt.figure()
plt.hist(sep)
print len(galah_cat), len(galah_tgas)
print len(tgas_cat), len(tgas_galah)/float(len(tgas_cat))
In [15]:
galah_cat.colnames
Out[15]:
In [25]:
tycho2_cat,m2 = xmatch.cds(tgas_cat, xcat='vizier:Tycho2',colRA='ra',colDec='dec',savefilename="tycho2.dat")
tgas_tycho2 = tgas_cat[m2]
In [ ]:
apass_cat,m2 = xmatch.cds(tgas_cat, xcat='vizier:')